<?php
// +----------------------------------------------------------------------
// | quanli team
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2020 http://www.fistforward.com/ All rights reserved.
// +----------------------------------------------------------------------
// | Author: allen.qiang
// +----------------------------------------------------------------------

/**
 * 会员短信ajax类
 */
class ajax_customerSms {

    public function execute() {

        if (isset($_REQUEST['operFlg']) && $_REQUEST['operFlg'] > 0) {

            switch($_REQUEST['operFlg']) {

                case 1: //发送短信
                    $this->sendSms();
                    break;
                default:
                    returnJsonData('参数错误');
                    break;
            }

        } else {

            returnJsonData('参数错误');

        }

    }

    /**
     * 发送短信
     */
    private function sendSms() {

            //加载短信类
            quanli_include('module/base/common/quanliSms.class.php');

            //实例化短信类
            $quanliSms = new quanliSms();

            //发送短信
            $result_array = $quanliSms->sendSMS( $_REQUEST['mobile'], $_REQUEST['smscontent'] );
            if ($result_array['code'] == 200) {
                returnJsonData('短信发送成功', 200);
            } else {
                returnJsonData('短信发送失败', 400);
            }

    }
}